import { Component, OnInit } from '@angular/core';
import { ScheduleService } from '../service/schedule.service';
import { Schedule, DEGREE } from '../model/schedule';

@Component({
  selector: 'app-schedule-box',
  templateUrl: './schedule-box.component.html',
  styleUrls: ['./schedule-box.component.scss']
})
export class ScheduleBoxComponent implements OnInit {
  
  public seriousUrgentSchedules: Schedule[] = [];
  public seriousNotUrgentSchedules: Schedule[] = [];
  public notSeriousUrgentSchedules: Schedule[];
  public notSeriousNotUrgentSchedules: Schedule[];
  public degree = {
    SERIOURS_NOT_URGENT: DEGREE.SERIOURS_NOT_URGENT,
    SERIOURS_URGENT: DEGREE.SERIOURS_URGENT,
    NOT_SERIOURS_NOT_URGENT: DEGREE.NOT_SERIOURS_NOT_URGENT,
    NOT_SERIOURS_URGENT: DEGREE.NOT_SERIOURS_URGENT,
  }

  constructor(public scheduleService: ScheduleService) {
  }

  async ngOnInit() {
    let options = {}
    this.seriousNotUrgentSchedules = await this.scheduleService.find({
      degree: DEGREE.SERIOURS_NOT_URGENT
    }, options);
    this.seriousUrgentSchedules = await this.scheduleService.find({
      degree: DEGREE.SERIOURS_URGENT,
    }, options);
    this.notSeriousNotUrgentSchedules = await this.scheduleService.find({
      degree: DEGREE.NOT_SERIOURS_NOT_URGENT
    }, options);
    this.notSeriousUrgentSchedules = await this.scheduleService.find({
      degree: DEGREE.NOT_SERIOURS_URGENT,
    }, options);
  }

}
